<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE>
<html>
<head>
<base href="<%=basePath%>">
<!-- 引入公共meta -->
<jsp:include page="static/iframe/import/_meta.jsp"></jsp:include>
<title>Newer宅急送-后台登录v1.0</title>
<!-- 引入x-admin公共css -->
<jsp:include page="static/iframe/import/_header.jsp"></jsp:include>
<!-- 引用自己写的样式 -->
<link rel="stylesheet" type="text/css"
	href="static/sys/login/css/login.css" />
</head>
<body class="login-bg">
	<div class="login">
		<div class="message">Newer宅急送—后台登录v1.0</div>
		<div id="darkbannerwrap"></div>
		<form method="post" class="layui-form" action="">
			<input name="username" placeholder="用户名" type="text"
				lay-verify="required" class="layui-input">
			<hr class="hr15">
			<input name="password" lay-verify="required" placeholder="密码"
				type="password" class="layui-input">
			<hr class="hr15">
			<input value="登录" lay-submit lay-filter="login" type="submit" />
			<hr class="hr20">
		</form>
	</div>
</body>
<!-- 引入x-admin公共js -->
<jsp:include page="static/iframe/import/_footer.jsp"></jsp:include>
<script type="text/javascript">
	layui.use([ 'form' ], function() {
		var form = layui.form;
		//监听提交
		form.on('submit(login)', function(data) {
			layer.load(0, {
				shade : false,
				time : 1000
			}); //0代表加载的风格，支持0-2
			setTimeout(function() {
				$.ajax({
					type : "post",
					url : "${pageContext.request.contextPath}/user/login",
					data : $("form").serialize(),
					success : function(result) {
						if (result.flag) {
							//登陆成功
							window.location.href="${pageContext.request.contextPath}/pages/index";
						}else{
							//登陆失败
							layer.msg(result.msg, {icon: 5});
						}
					}
				});
			}, 1000);
			return false;
		});

	});
</script>
</html>